#ifndef _FRUSTUMG_
#define _FRUSTUMG_

#include <base\vec3f.h>
#include <base\plane.h>
#include <base\box3f.h>

class viewFrustum {

	enum {
		TOP = 0, BOTTOM, LEFT, RIGHT, NEARP, FARP
	};

public:

	static enum {OUTSIDE, INTERSECT, INSIDE};

	plane pl[6];

	vec3f ntl, ntr, nbl, nbr, ftl, ftr, fbl, fbr;
	float nearD, farD, ratio, angle, tang;
	float nw, nh, fw, fh;

	viewFrustum();
	~viewFrustum();

	void setCamInternals(float angle, float ratio, float nearD, float farD);
	void setCamDef(vec3f &p, vec3f &l, vec3f &u);
	int pointInFrustum(vec3f &p);
	int sphereInFrustum(vec3f &p, float ratio);
	int boxInFrustum(box3f &b);

	void drawPoints();
	void drawLines();
	void drawPlanes();
	void drawNormals();
};

#endif